package org.raftkv.commons;

import java.util.Objects;

/**
 * 二元组
 *
 * @author wzy
 */
public class Tuple<F, S> {

    private final F FIRST;
    private final S SECOND;

    public Tuple(F first, S second) {
        this.FIRST = first;
        this.SECOND = second;
    }

    public F getFirst() {
        return FIRST;
    }

    public S getSecond() {
        return SECOND;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Tuple<?, ?> tuple = (Tuple<?, ?>) o;
        return Objects.equals(FIRST, tuple.FIRST) &&
                Objects.equals(SECOND, tuple.SECOND);
    }

    @Override
    public int hashCode() {
        return Objects.hash(FIRST, SECOND);
    }

    @Override
    public String toString() {
        return "Tuple{" +
                "first=" + FIRST +
                ", second=" + SECOND +
                '}';
    }

}
